package com.atguigu.edustatistic.controller;


import com.atguigu.commonutils.R;
import com.atguigu.edustatistic.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2022-09-18
 */
@RestController
@RequestMapping("/edustatistic/statistics")
public class StatisticsDailyController {
    @Autowired
    private StatisticsDailyService statisticService;

    @GetMapping("countRegisterCheck/{day}")
    public R countRegister(@PathVariable String day){
        statisticService.createStatisticsByDay(day);
        return R.ok();
    }

    @GetMapping("showChart/{type}/{start}/{end}")
    public R showChart(@PathVariable String type,@PathVariable String start,@PathVariable String end){
        Map<String,Object> map=statisticService.showChart(type,start,end);
        return R.ok().data(map);
    }
}

